#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;

void moveZeroes(vector<int>& nums)
{
     int left = -1;
     int right = 0;
     while (right < nums.size())
     {
         if (nums[right] == 0)
         {
             right++;
         }
         else
         {
             left++;
             int temp = 0;
             temp = nums[left];
             nums[left] = nums[right];
             nums[right] = temp;
             right++;
         }
     }
}

void test()
{
    vector<int> v1 = { 0,1,0,3,12 };
    vector<int> v2 = { 0 };
    vector<int> v3 = { 1 };
    moveZeroes(v1);
    moveZeroes(v2);
    moveZeroes(v3);

    for (auto& e : v1)
    {
        cout << e << " ";
    }
    cout << endl;

    for (auto& e : v2)
    {
        cout << e << " ";
    }
    cout << endl;

    for (auto& e : v3)
    {
        cout << e << " ";
    }
    cout << endl;
}
int main()
{
    test();
    return 0;
}